﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Runtime.Serialization;

namespace OMSService
{
    [DataContract]
    public class OrderItemModel
    {
        int id;
        int quantity;
        decimal price;
        ItemModel itemModel;
        int itemId;
        string dimension;

        public OrderItemModel() { }

        public OrderItemModel(int quantity, decimal price, string dimension, ItemModel iteModel)
        {
            Quantity = quantity;
            Price = price;
            Dimension = dimension;
            ItemModel = itemModel;
            ItemId = ItemModel.Id;
        }

        public OrderItemModel(OrderItem orderItem)
        {
            Id = orderItem.Id;
            Quantity = orderItem.Quantity;
            Price = orderItem.Price;
            Dimension = orderItem.Dimension;
            ItemModel = new ItemModel(orderItem.Item);
            ItemId = ItemModel.Id;
        }

        #region setters
        [DataMember]
        public int Id
        {
            get { return id; }
            private set { id = value; }
        }

        [DataMember]
        public int Quantity
        {
            get { return quantity; }
            set { quantity = value; }
        }

        [DataMember]
        public decimal Price
        {
            get { return price; }
            set { price = value; }
        }

        [DataMember]
        public ItemModel ItemModel
        {
            get { return itemModel; }
            private set { itemModel = value; }
        }

        [DataMember]
        public int ItemId
        {
            get { return itemId; }
            set { itemId = value; }
        }

        [DataMember]
        public string Dimension
        {
            get { return dimension; }
            set { dimension = value; }
        }
    }
        #endregion
}


